package com.cb.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.jia.vo.admin.SitesVo;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.jia.entity.Coordinate;
import com.cb.service.CoordinateService;
import com.cb.mapper.CoordinateMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.management.Query;
import java.util.ArrayList;
import java.util.List;

/**
* @author 王利明
* @description 针对表【t_coordinate】的数据库操作Service实现
* @createDate 2024-04-29 16:24:44
*/
@Service
public class CoordinateServiceImpl extends ServiceImpl<CoordinateMapper, Coordinate>
    implements CoordinateService{
    @Autowired
    private  CoordinateMapper coordinateMapper;
    @Override
    public List<SitesVo> mapList() {
        List<Coordinate> coordinates = this.coordinateMapper.selectList(null);
        List<SitesVo> list=new ArrayList<>();
        coordinates.forEach(item->{
            SitesVo sitesVo=new SitesVo();
            sitesVo.setId(item.getId());
            sitesVo.setX(item.getX());
            sitesVo.setY(item.getY());
            list.add(sitesVo);
        });
        return list;
    }

    @Override
    public Coordinate mapinfo(String x, String y) {
        QueryWrapper<Coordinate> query=new QueryWrapper<>();
        query.eq("x",x);
        query.eq("y",y);
        return this.coordinateMapper.selectOne(query);
    }
}




